package com.hnhegui.backend.platform.vo.order.response;

import com.hnhegui.backend.order.dto.response.OrderDocumentResponseDTO;
import com.hnhegui.backend.order.enu.DeliveryTypeEnum;
import com.hnhegui.backend.order.enu.OrderStatusEnum;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 刘大海
 * @since 2025/10/27 11:07
 */
@Getter
@Setter
public class OrderDocumentResponseVO {
    private String orderId;

    private String orderNo;

    private String userId;

    private OrderStatusEnum status;

    private BigDecimal totalAmount;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    private List<OrderDocumentResponseDTO.OrderItem> items;

    private DeliveryTypeEnum deliveryType;

    private OrderDocumentResponseDTO.ShippingAddress shippingAddress;

    private OrderDocumentResponseDTO.PaymentInfo paymentInfo;

    private OrderDocumentResponseDTO.Fulfillment fulfillment;

    /**
     * 订单商品项
     */
    @Data
    public static class OrderItem {
        private String productId;

        private String productName;

        private Integer quantity;

        private BigDecimal price;

        private BigDecimal subtotal;
    }

    /**
     * 收货地址
     */
    @Data
    public static class ShippingAddress {
        private String province;

        private String city;

        private String district;

        private String detail;

        private String receiverName;

        private String receiverPhone;
    }

    /**
     * 支付信息
     */
    @Data
    public static class PaymentInfo {
        private String paymentId;

        private String paymentMethod;

        private String paymentStatus;

        private String transactionId;

        private BigDecimal paidAmount;

        private LocalDateTime paidTime;
    }

    /**
     * 履约信息
     */
    @Data
    public static class Fulfillment {
        private String fulfillmentType;

        private String fulfillmentStatus;

        private LocalDateTime fulfillmentTime;

        private OrderDocumentResponseDTO.ExpressInfo expressInfo;

        private OrderDocumentResponseDTO.PickupInfo pickupInfo;

        private OrderDocumentResponseDTO.VirtualInfo virtualInfo;
    }

    /**
     * 快递信息
     */
    @Data
    public static class ExpressInfo {
        private String expressCompany;

        private String trackingNo;
    }

    /**
     * 自提信息
     */
    @Data
    public static class PickupInfo {
        private String storeId;

        private String pickupCode;

        private LocalDateTime pickedUpTime;
    }

    /**
     * 虚拟商品信息
     */
    @Data
    public static class VirtualInfo {
        private String activationCode;

        private String downloadUrl;
    }
}
